package com.lzf.yh.userService.impl;

import com.lzf.yh.commons.JsonBean;
import com.lzf.yh.dao.GuitarInfoMapper;
import com.lzf.yh.entity.GuitarInfo;
import com.lzf.yh.userService.GuitarInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Auther: Wyz
 * @Date: 2021/3/31 10:52
 * @Description:
 */
@Service
public class GuitarInfoServiceImpl implements GuitarInfoService {

    @Autowired
    private GuitarInfoMapper guitarInfoMapper;

    /**
     * 根据条件查询吉他信息表中的所有吉他
     * @param guitarInfo 查询所用的条件，可以为空
     * @return返回json格式的查询结果
     */
    @Override
    public JsonBean selectGuitarInfoAll(GuitarInfo guitarInfo) {
        return new JsonBean(0,"",guitarInfoMapper.selectAllByGuitarInfo(guitarInfo));
    }

    /**
     * 查询一个吉他信息
     * @param id 查询条件
     * @return 返回的结果
     */
    @Override
    public JsonBean selectOneGuitarInfo(Integer id) {
        return new JsonBean(0,"",guitarInfoMapper.selectByPrimaryKey(id));
    }

    @Override
    public JsonBean selectByName(String name) {
        return new JsonBean(0,"",guitarInfoMapper.selectByName(name));
    }
}
